package com.lovo;

import java.util.Scanner;

public class Player extends Role {
    public void getRadomNumber() {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入数字：1-石头，2-剪刀，3-布");
        int number = -1;
        while (true) {

            try {
                number = scan.nextInt();
                if (number == 1) {
                    System.out.println("人类：我出石头");
                } else if (number == 2) {
                    System.out.println("人类：我出剪刀");
                } else if (number == 3) {
                    System.out.println("人类：我出布");
                }
                if (number>3||number<1){
                    System.out.println("请输入1到3");
                    continue;
                }
                break;
            } catch (Exception e) {
                System.out.println("请输入数字");
                scan.next();
            }

        }
        this.setNumber(number);
    }
}
